package com.sky.mapper;

//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sky.entity.Setmeal;
import com.sky.vo.DishItemVO;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import com.github.pagehelper.Page;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.*;

@Mapper
public interface SetmealMapper {
    /**
     * 根据分类ID查询套餐
     * @param categoryId
     * @return
     */
    @Select("select * from setmeal where category_id=#{categoryId}")
    List<Setmeal> getSetmeal(Long categoryId);
    /**
     * 根据套餐id查询菜品
     */
    List<DishItemVO> getSetmealId(Long setMEalId);

    @Select("select * from setmeal where id = #{id}")
    Setmeal getSetmealById(Long id);

    /**
     * 分页查询
     * @param setmealPageQueryDTO
     * @return
     */
    Page<SetmealVO> page(SetmealPageQueryDTO setmealPageQueryDTO);


    /**
     * 添加套餐
     * @param setmeal
     */
    @Options(keyProperty = "id",useGeneratedKeys = true)
    @Insert("insert into setmeal(category_id,name,price,status,description,image,create_time,update_time,create_user,update_user)" +
            " values(#{categoryId},#{name},#{price},#{status},#{description},#{image},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void insert(Setmeal setmeal);


    /**
     * 根据id查找套餐
     * @param id
     * @return
     */
    @Select("select * from setmeal where id = #{id}")
    Setmeal getIdSetmeal(Long id);

    /**
     * 根据id删除套餐
     * @param id
     */
    @Delete("delete from setmeal where id = #{id}")
    void deleteSetmeal(Long id);

    /**
     * 修改套餐
     * @param setmeal
     */
    void updeteSetmeal(Setmeal setmeal);
}
